﻿using UnityEngine;
using System.Collections;

// aplaczek 26.11.2014
public class BulletCollider : MonoBehaviour
{
    public int damage = 1;

    void OnCollisionEnter(Collision coll)
    {

        //collision with enemy
        EnemyCollider enemy = coll.gameObject.GetComponent<EnemyCollider>();
        if (enemy != null) 
        {
            enemy.TakeDamage(damage);
        }

        //collision not with other bullet
        if(coll.gameObject.GetComponent<BulletCollider>() == null)
        {
            DestroyObject(gameObject);
        }
        
    }

}
